<%--
  Created by IntelliJ IDEA.
  User: wg
  Date: 2017/10/17
  Time: 8:41
  Description: 
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" errorPage="error.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>显示主页面</title>
    <link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.css"/>
    <style>
        table th, table td {
            text-align: center;
        }
    </style>
</head>
<body>
    <h4 class="text-center">城市信息</h4>
    <div class="row">
        <div class="col-lg-offset-4 col-lg-6">
            <form class="form-inline" action="${pageContext.request.contextPath}/find" method="get">
                <div class="form-group">
                    <label for="searchTxt">Country Code</label>
                    <input type="text" class="form-control" id="searchTxt" name="countryCode" placeholder="CountryCode">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>
        </div>
    </div>


    <div class="row">
        <div class="col-lg-offset-2 col-lg-8">
            <table class="table table-bordered table-striped table-condensed table-hover
                table-responsive">
                <thead>
                <tr>
                    <th>Id</th>
                    <th>Name</th>
                    <th>CountryCode</th>
                    <th>District</th>
                    <th>Population</th>
                    <th>Function</th>
                </tr>
                </thead>

                <tbody>
                <c:forEach items="${requestScope.cities}" var="city">
                    <tr>
                        <td>${city.id}</td>
                        <td>${city.name}</td>
                        <td>${city.countryCode}</td>
                        <td>${city.district}</td>
                        <td>${city.population}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/findSingle?id=${city.id}">修改</a>
                            |
                            <a href="${pageContext.request.contextPath}/deleteSingle?id=${city.id}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-offset-2 col-lg-8 text-center">
            首页 下一页 上一页 尾页 第n页/共n页
        </div>
    </div>
</body>
</html>
